package cn.monkey.family.data.uc.auth.wechat;

import lombok.Getter;

@Getter
public enum WechatAuthorizationRespCode {
    SYSTEM_ERROR(-1, "SYSTEM_ERROR"),
    SUCCESS(0, "SUCCESS"),
    INVALID_CODE(40029, "INVALID_CODE"),
    TOO_MANY_REQUESTS(45011, "TOO_MANY_REQUESTS"),
    CODE_BLOCKED(40226, "CODE_BLOCKED"),

    ;
    private final int code;
    private final String msg;

    WechatAuthorizationRespCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    public static WechatAuthorizationRespCode valueOf(int code) {
        for (WechatAuthorizationRespCode value : values()) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }
}
